#include <bits/stdc++.h>
using namespace std;

int n,m;
vector<int> choosn;

void calc(int x)
{

    if(choosn.size()>m||choosn.size()+(n-x+1)<m) return;
    if(x>n)
    {
        for(auto i:choosn) cout<<i<<" ";
        cout<<endl;
        return;
    }
    choosn.push_back(x);
    calc(x+1);
    choosn.pop_back();
    calc(x+1);
}
int main() {             // n为排列数，m为组合数      
    cin >> n >> m;
    calc(1);
    return 0;
}
